<%--
  Created by IntelliJ IDEA.
  User: HeiMei
  Date: 2015/11/13
  Time: 9:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE HTML>
<html>

<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/public/mapObj.js"></script>
<head>
    <title></title>
</head>
<body>
<div class="pd-20">
    <form action="" method="post" class="form form-horizontal" id="form-fieldPark-edit">
        <input type="hidden" name="uuid" value="${fieldParkInfo.uuid}">

        <div class="row cl">
            <label class="form-label col-2">网点名称：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="netName">
            </div>
            <label class="form-label col-2">自行车地址：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="address">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">网点：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="netNo">
            </div>
            <label class="form-label col-2">网点状态：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="netStatus">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-2">网点类型：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="netType">
            </div>
            <label class="form-label col-2">基础附加：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="baseAttach1">
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-2">自行车容量(个)：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="bicycleCapacity">
            </div>
            <label class="form-label col-2">自行车总数(个)：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="bicycleNum">
            </div>
        </div>
        <div class="row cl" hidden="true">
            <label class="form-label col-2" hidden="true">所属省份：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="runLevelProvince" hidden="true">
            </div>
            <label class="form-label col-2" hidden="true">所属城市：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="runLevelCity" hidden="true">
            </div>
        </div>
        <div class="row cl">
            <%--<label class="form-label col-2" hidden="true">所属地区：</label>--%>
            <%--<div class="formControls col-2">--%>
            <%--<input type="text" class="input-text"  placeholder="" id="runLevelDistrict" hidden="true">--%>
            <%--</div>--%>
            <label class="form-label col-2">所属街道：</label>

            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="" id="runLevelTownStreet">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">是否开放：</label>

            <div class="formControls col-2">
          <span class="select-box">
              <select class="select" size="1" name="isOpen" id="isOpen">
                  <option value="true" selected>是</option>
                  <option value="false">否</option>
              </select>
            </span>
            </div>
            <label class="form-label col-2">开放时间：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="openDate">
            </div>

        </div>


        <div class="row cl" style="display:none;">
            <label class="form-label col-2">地图经度：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="lng" readonly>
            </div>
            <label class="form-label col-2">地图维度：</label>

            <div class="formControls col-2">
                <input type="text" class="input-text" placeholder="" id="lat" readonly>
            </div>
            <label class="form-label col-2">地图：</label>

            <div class="formControls col-2">
                <div class="divFloat">
                    <a onClick="findLocalPoint()" class="btn btn-default radius">选择坐标</a>
                </div>
            </div>
        </div>
        <div class="row cl">
                <div class="col-2 col-offset-2">
                    <button onClick="filepark_save();" class="btn btn-secondary radius" type="button"><i
                            class="Hui-iconfont">&#xe632;</i> 保存
                    </button>
                    <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            <label class="form-label col-2">地图：</label>
            <div class="formControls col-2">
                <div class="divFloat">
                    <a onClick="findLocalPoint()" class="btn btn-default radius">选择坐标</a>
                </div>
            </div>
        </div>
    </form>
</div>
</body>
</html>
<%@include file="../../head-ui.jsp" %>
<script type="text/javascript">
    function filepark_save() {
        $.ajax({
            url: '<%=request.getContextPath()%>/back/bike/updateBikePark.do',
            type: 'POST',
            data: "address=" + $('#address').val() + "&baseattach1" + $('#baseAttach1').val() + "&bicyclecapacity=" + $('#bicycleCapacity').val() + "&bicyclenum=" + $('#bicycleNum').val()
            + "&isopen=" + $('#isOpen').val() + "&netno=" + $('#netNo').val() + "&netname=" + $('#netName').val() + "&netstatus=" + $('#netStatus').val()
            + "&lng=" + $('#lng').val() + "&lat=" + $('#lat').val() + "&nettype=" + $('#netType').val()
            + "&runlevelcity=" + $('#runLevelCity').val() + "&runleveldistrict=" + $('#runLevelDistrict').val()
            + "&runlevelprovince=" + $('#runLevelProvince').val() + "&runleveltownstreet=" + $('#runLevelTownStreet').val() + "&unid=" +${bikepark.unid},
            success: function () {
                layer.alert('保存成功!', {
                    icon: 1,//2表示保存失败图标，1表示保存成功
                    closeBtn: false,
                    shadeClose: true,
                    title: "提示"
                }, function (index) {
                    layer.close(index)
                });
            }
        })
    }

    $(function () {
        $('#address').val('${bikepark.address}');
        $('#baseAttach1').val('${bikepark.baseattach1}');
        $('#bicycleCapacity').val('${bikepark.bicyclecapacity}');
        $('#bicycleNum').val('${bikepark.bicyclenum}');
        $('#isOpen').val('${bikepark.isopen}');
        $('#netNo').val('${bikepark.netno}');
        $('#netName').val('${bikepark.netname}');
        $('#netStatus').val('${bikepark.netstatus}');
        $('#netType').val('${bikepark.nettype}');
        $('#openDate').val('${bikepark.opendate}'.toString());
        $('#runLevelCity').val('${bikepark.runlevelcity}');
        $('#runLevelDistrict').val('${bikepark.runleveldistrict}');
        $('#runLevelProvince').val('${bikepark.runlevelprovince}');
        $('#runLevelTownStreet').val('${bikepark.runleveltownstreet}');
        $('#lng').val('${bikepark.lng}');
        $('#lat').val('${bikepark.lat}');
    });
    function findLocalPoint() {
        var lng = $("#lng").val();
        var lat = $("#lat").val();
        var myurl = "<%=request.getContextPath()%>/back/bike/bikePark-Map.do?lng=" + lng + "&lat=" + lat;
        layer.open({
            type: 2,
            title: "坐标选择(拖动红点选择位置)",
            area: ['500px', '500px']
            , shade: 0,
            content: myurl
        })
    }
    var mapObj = null;

</script>

